package com.xbongbong.pro.marketManage.pojo.dto;


import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.QueryIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.collections4.CollectionUtils;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * 关联销售线索列表
 * @author chunyang.qin
 * @version v1.0
 * @date 2020/11/10 11:10
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class RelationSaleClueListDTO extends BaseDTO {

    private static final long serialVersionUID = -3912324808955024041L;


    /**
     * 业务类型id
     */
    @NotNull(message = "{dto.msg.listAppSearchFilter.businessType.NotNull}")
    private Integer businessType;

    /**
     * 穿透的code（1 全部线索 ； 2 有效线索；3 转换线索）
     */
    private Integer throughCode;


    /**
     * 市场活动id
     */
    private Integer dataId;

    /**
     * 搜索条件
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private List<ConditionsEntityExt> conditions;
    /**
     * 分页当前页
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer page;

    /**
     * 分页每页记录数
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer pageSize;
    /**
     *  or：任一； and：全部（筛选项的条件是任一一个满足，还是需要全部满足）
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String rel;

    /**
     * 表单id
     */
    private Long formId;

    public RelationSaleClueListDTO() {
        rel = "and";
        page = 1;
        pageSize = 20;
    }

    public List<ConditionsEntityExt> getConditions(){
        if(CollectionUtils.isEmpty(conditions)){
            this.conditions =  new ArrayList<>();
        }
        return conditions;
    }
}
